package task06_03;

import java.io.*;


  /**
   * @author Administrator
   * 创建字节缓冲流对象，通过缓冲流对象实现信息写入文件，以及读取文件内容
   */
  public class Task06_03 {
    public static void main(String[] args) throws Exception {
        /*OutputStream out=new FileOutputStream("a.txt");
        BufferedOutputStream bos=new BufferedOutputStream(out);*/
      BufferedOutputStream bos=new BufferedOutputStream(new FileOutputStream("a.txt"));

      String s="Hello Java";
      bos.write(s.getBytes());
      bos.close();

      BufferedInputStream bis=new BufferedInputStream(new FileInputStream("a.txt"));
      byte[] bys=new byte[1024];
      int len=0;
      while((len=bis.read(bys))!=-1){
        System.out.println(new String(bys,0,len));
      }

    }
  }



